// ==UserScript== // @name Test FC // @namespace http://meurgues.fr/greasemonkey // @description version 0.5.1 Change the look&feel of Le Forum Catholique // @include https://leforumcatholique.org/* // @include http://leforumcatholique.org/* // @include https://www.leforumcatholique.org/* // @include http://www.leforumcatholique.org/* // @grant GM.setValue // @grant GM.getValue // @grant GM.listValues // ==/UserScript== (async () => { debug = false; if (debug) { console.log("Beginning"); console.log("location.pathname=" + this.location.pathname); } //global config confAnciens = 881977; document.defaultColor = "#6699cc"; var allTextareas, thisTextarea; // Icônes en mode data dataIconMaximize = "data:image/gif,GIF89a%07%00%09%00%91%00%00%FF%FF%FF%5B~%9C%D7%E6%F0%00%00%00!%F9%04%00%00%00%00%00%2C%00%00%00%00%07%00%09%00%00%02%0F%94%8F%A9%1B%ED%01%1E%14%B1%81%13%2F%D2%A2%00%00%3B"; dataIconMinimize = "data:image/gif,GIF89a%07%00%09%00%D5%00%00%FF%FF%FF%5B~%9C%D7%E6%F0%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00!%F9%04%00%00%00%00%00%2C%00%00%00%00%07%00%09%00%00%06%16%40%81pH%2C%0A%01E%40%00y%0C8%91J%E7SJ5Z%05A%00%3B"; dataIconCloseToast = "data:image/gif,GIF89a%0D%00%0D%00%E6%00%00%FF%FF%FF%E7pT%D0%DE%F4%E8x%5D%E3_%3E%DE%E8%F7%E8w%5C%E6mP%E2L%23%E3N%22%C2%2B%01%E5hI%E9%80f%E1W4%E5Q%24%E5gJ%E6mQ%ED%93%7D%F3%B6%A7%C3%3D%18%E2T1%C2%3D%1B%E8z_%E0T1%E6D%0D%CEv_%C9%3B%12%C5B%1E%C2E%25%E8%7Cb%C91%04%E9%7Ff%E4%60%40%E6oU%DB%40%19%E6L%18%E7rX%E1P(%E8P%1C%E7oS%E1Y7%D9%7Fh%E8e%3B%E6G%11%EE%97%82%E9%5C%2B%E4%5E%3E%C97%0D%DFQ-%E8u%5C%C3%2C%01%E0K%26%E5hK%E0W4%C6D%23%E6A%09%C0%3D%1C%E5gH%E8sY%EA%83j%F0%A8%96%CA8%0D%E3U*%E1%3A%04%E6c%3E%C2B%22%EA%86l%DEM)%C9%3E%17%E1W1%E5L%1A%E7rV%E7qT%ED%95~%BD6%15%E4eF%EC%94%7D%C82%06%EA%86m%E7%605%DB%86q%E0Q-%E5N%1F%E6lO%C3F%26%E5R%23%E3%5B9%C0%3E%1D%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00!%F9%04%00%00%00%00%00%2C%00%00%00%00%0D%00%0D%00%00%07%7B%80%05%00%83%84%85%00%82%12%11%0C%03G'%079%040P%83%2C%3CLN%1F%16%06H%0B(A%83%3BI%83!%0F%20%83%17%1C%83%03B%84.%84QT%83%01%1D1%86%08%256%834%3A%24S%84%0ER%09%1B%83%04%10%01%86%26FD%83%14K%84*%84%2B%3D%833V%83%40O-%837%1E%83%22C5%0DE%3EU%23%18%3F%0A%83)J8W%15%13%1A%2FM2%19%00%02%86%F8%02%81%00%3B"; dataIconFolded = "data:image/gif,GIF87a%09%00%09%00%D5%00%00%24.D%8C%9A%AC%AC%D6%EC%DC%F2%FC%9C%B6%CC%CC%D2%DC%B4%C2%CC%F4%F2%F4%AC%CA%DC%CC%E2%EC%A4%AE%BC%AC%BA%CC%CC%EA%F4%8C%A2%BC%BC%DE%EC%EC%EE%F4%A4%B6%C4%BC%CA%D4%D4%E2%ECt%8E%A4%BC%D2%DC%FC%FE%FC%CC%E6%EC%EC%F6%FC%A4%BA%C4%8C%9E%B4%B4%C2%D4%F4%F6%F4%CC%E2%F4%A4%B2%C4%AC%BE%CC%CC%EA%FC%94%A2%B4%EC%F2%F4%BC%CA%DC%84%92%A4%BC%D6%E4%A4%BA%CC%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%2C%00%00%00%00%09%00%09%00%00%06E%C0%CA%A6%A0%08(%0A%87%CAa%A1%91%84%24%86%C5A%E4%19%0C%00%D6%85%A8A%F9p%00%96%0F%A51%11%00%CEg%C1%24%83p8%00nDF%03%E1%7C%ED%04%CD%A3%03%A1X(%10%1D%0F%15!%11%20%23%20%11!%15A%00%3B"; dataIconUnfolded = "data:image/gif,GIF87a%09%00%09%00%D5%00%00%8C%96%AC%C4%CE%D4%D4%EA%F4%CC%DE%EC%EC%EE%F4%DC%E2%E4%A4%B6%C4%E4%EA%EC%CC%D6%DC%CC%E6%F4%B4%C2%D4%F4%FA%FC%E4%E6%EC%E4%F2%F4%C4%D2%DC%DC%EA%F4%D4%DE%E4%DC%E6%EC%B4%BE%CC%D4%DA%E4%D4%E6%EC%BC%C6%D4%C4%CE%DC%EC%F6%FC%DC%E2%EC%AC%BA%CC%E4%EE%F4%CC%D6%E4%B4%C6%D4%FC%FE%FC%E4%F2%FC%DC%EE%F4%D4%E2%EC%D4%E6%F4%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%2C%00%00%00%00%09%00%09%00%00%06D%C0%0E%81%11%90%040%84%8E%06%B1i%2C%1A%10%84%06%B3%B9X%AD%9B%82%22%F4%F1t%3F!%85!%01(%97%13%06%C5%E0%23%10%B0%07%8A%89%E3%A3%F9%D8%1D%83%83%C5%01%D2D%1C%16%0C%1D%07%10%15%19%15%10%07%1DA%00%3B"; dataIconAnswer = "data:image/gif,GIF87a%10%00%11%00%F7%00%00%00%00%00%A5%AD%C6%94%AD%C6%94%A5%B5%B5%B5%C6%E7%EF%F7%FF%FF%FF%E7%F7%F7%F7%F7%F7%94%9C%B5%E7%E7%E7%C6%D6%F7%F7%F7%FF%E7%E7%F7%D6%DE%F7%C6%D6%E7%D6%D6%E7%C6%CE%D6%B5%C6%E7%B5%C6%D6%A5%BD%E7%94%AD%D6%B5%BD%E7%B5%BD%D6%A5%B5%C61Jc%D6%DE%E7%F7cB%D6J!%C6%C6%D6%A5B!%94%B5%E7%D6%E7%F7%F7%FF%FF%94%A5%D6%A5%B5%D6%C6%CE%E7%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00!%F9%04%00%00%00%00%00%2C%00%00%00%00%10%00%11%00%00%08%B9%00%3B%08%1C%D8!%80%80%00%01%06%10%5C%D8%81%40%01%03%06%0E%20H%C0P%A0C%88%08%0A(X%A0p%E1E%06%05%1A(p%F0%00%02%C5%81%01%1E%90%24%19A%C2%04%0A%15%04%24%B0p%E1%02%86%0B%01%1C%40%84%C8%00d%83%0C%16%18%F0%0C%90A%C3N%06%1B8H%C8p%01%81%01%A1%0A%8B%22%00%C9%C1%C3%05%A6%0C(%7C%A8%90%20%83W%81%1A%1A%3C%B0%90!%00O%06%0D%22D(%AB%00%04%84%05%02%CA%86%D0ZA%84%88%09%19F%BE%9D%20%22%C3%80%A7%20%15%3CX%3B%C1%C2%88%11%22%E2%26%C8%BA%D5.%5E%AF%90%BD%260%E0%40%C3%60%12%1D2T%EC%1A%19r%C5%CF%A0C%2F%0C%08%00%3B"; dataIconDetail = "data:image/gif,GIF87a%10%00%10%00%F7%00%00%00%00%00%FF%FF%FF4%18%19ULT%CC%C4%CC%DC%D4%DC%D4%CC%D4%FC%F4%FC%F4%EC%F4%E4%DC%E4LDM%BC%B4%BD%C4%BC%C5%24%1C)%04%04%0C%0C%0C%1C%2C%2C%3CDD%5C44DDDT%24%24%2CLL%5C%7C%7C%8C%8C%8C%9C%A4%A4%B4%0C%0C%0DLLP%C4%C4%CC%B4%B4%BC%D4%D4%DC%F4%F4%FC%20%24%3C%2F4L7%3CT%14%1C%3C%2C4T%DA%DC%E4ELdU%5Ct%A7%AC%BC%3CD%5CLTl%C9%CC%D4%E9%EC%F5%0D%14%24%1D%244%04%0A%16%2C4D%3CDTDL%5CLTdT%5Cjdlz%15%1C'L%5Bt%25%2C74%3CI%5C_d%A7%AC%B4%B7%BC%C4%0C%1C4DTl%5Cl%84u%7C%86%85%8C%96%1C%23%2C%3CCL%9C%A7%B4%95%9C%A5%94%A3%B4%04D%84%04%14%24%0C%1C%2CD%84%C4%14%244%1C%2C%3C%244D%2C%3CL4DT%3CL%5CDTdL%5Cl%5Cl%7CDLTlx%84LT%5C%7C%88%94%8C%98%A4456WXYghi%E7%E8%E9%5Bht%7B%8C%9C%3CSd%9B%A4%AB%04%1C%2C%0C%244%14%2C%3C4L%5CD%5ClLdty%84%8C%8A%94%9Bort%97%9A%9C'4%3Cgt%7C%AC%B4%B9%06%14%1C%3CAD%0C%1C%24%14%24%2C%1C%2C4%2C%3CD4DL%3CLTDT%5CL%5CdUdl%BC%C4%C8%A5%A9%AB%88%8A%8B%04%A4%E4%CC%D4%D7%04%1C%24%0C%24%2C%14%2C4%1C4%3C%24%3CD%2CDL4LT%3CT%5CD%5Cd%A4%B4%B9%EB%F4%F7wz%7BLdk%DC%E4%E6%5Cty%8C%A4%A8%14%2C%2C%14%24%24%1C%2C%2C4LLD%5C%5C4DD%1C%24%24%3CLL*44DTT%24%2C%2CL%5C%5Cr%84%84LTT%B3%BC%BC%14%15%15%C3%CC%CCDGG%F3%FC%FC%D4%DC%DC%1B%1C%1C%3A%3C%3C%84%94%93%04%0D%0C%7C%84%83%0C%14%11*5%2C%3EMA%3BD%3C%F3%FC%F4%18%26%19%B2%BE%B3%04%0E%04%24%2C%24KUK%5Ce%5Ckuk%EB%F4%EB6~3%5C%D9S%26U%23T%5DS%AB%B6%AAR%A4D%CC%D4%CA%D4%DD%D1%C4%CE%C0%8C%97%83%9C%9F%94%BC%C8%91%D0%DD%9A%C8%D8w57%2BwyiUVKefZ%A6%A7%9A%0D%0D%04%BF%BF%B2%B5%B5%AA%CC%CC%C3%FC%FC%F3%DC%DC%D4%C4%C4%C2%95%95%94%E4%E3%B9%98%97%89%E9%D88%2C)%0C%F5%F4%EA%E8%E6%D9%A7%92%26%D8%D5%CAeT%1A-*%24%85%83%81%B4%AB%A5%EA%DA%D1%CD%C3%BE%D6%CA%C6tlj%95%8B%89D%3E%3D%F7%EC%EA%20%0B%08d%5C%5B%A4%9C%9B_%05%05%D0%14%146%07%07%84%14%14%960.w'%26%0C%04%04P!!%E5pp%A6SS%EC%96%96%C0%8C%8B%F3%BA%BATLL%DD%D4%D4%BC%B4%B4%FC%F4%F4%DD%DC%DC%BD%BC%BC%FC%FC%FC%F4%F4%F4%D4%D4%D4%CC%CC%CC%B4%B4%B4%2C%2C%2C%24%24%24%04%04%04%FF%FF%FF%2C%00%00%00%00%10%00%10%00%00%086%00%01%08%1CH%B0%A0%C1%83%08%13*%5C%C8%90%60%92%87%10%23%EE1R0%A2D%23%F6%0CZL21%E3%C1%8B%C8%14%3E%DC%23b%07%C3%89x%1A%AA%5C%C9%B2%E5%C2%80%00%3B"; function filterFolding(elem){ return elem.className == 'folding'; } function indentLevel(spaces) { level = 0; if (spaces > 1) { level = (spaces-2)/4; } return level+1; } function requestPage(src, func) { var xhr = new window.XMLHttpRequest(); xhr.onreadystatechange = function() { func(xhr); }; xhr.open("GET", src); // this fixes the content type glitch... xhr.overrideMimeType("text/html; charset=UTF-8"); xhr.send(null); } function requestPage2(src, j, el, func) { var xhr = new window.XMLHttpRequest(); xhr.onreadystatechange = function() { func(xhr, j, el); }; if (debug) {console.log("requestPage2 = " + src)}; xhr.open("GET", src); // this fixes the content type glitch... xhr.overrideMimeType("text/html; charset=UTF-8"); xhr.send(null); } function requestPage3(src, j, func) { var xhr = new window.XMLHttpRequest(); xhr.onreadystatechange = function() { func(xhr,j); }; xhr.open("GET", src); // this fixes the content type glitch... xhr.overrideMimeType("text/html; charset=UTF-8"); xhr.send(null); } function PreviewWindow(title) { this.setTitle = PreviewWindow_setTitle this.setHTMLContent = PreviewWindow_setHTMLContent this.setDOMContent = PreviewWindow_setDOMContent this.setVisible = PreviewWindow_setVisible this.setID = PreviewWindow_setID this.menu = document.createElement('div') closebutton = document.createElement('img') closebutton.src = dataIconCloseToast closebutton.addEventListener('click', function (e) { document.previewWindow.setVisible(false) }, false); this.menu.appendChild(closebutton) this.title = document.createElement('span') this.title.textContent = title this.title.id = 'previewTitle' this.menu.appendChild(this.title) this.answer = document.createElement('form') this.answer.style.display = 'inline' this.answer.method = 'post' this.answer.action = 'reponseN.php' button = document.createElement('input') button.value = 'submit' button.type = 'image' button.src = dataIconAnswer this.answer.appendChild(button) hidden = document.createElement('input') hidden.type = 'hidden' hidden.value = 0 hidden.name = 'num' this.answer.appendChild(hidden) this.menu.appendChild(this.answer) this.content = document.createElement('div') this.content.style.overflowY = 'scroll'; this.content.style.height = 300-15; this.main = document.createElement('div') this.main.appendChild(this.menu) this.main.appendChild(this.content) this.main.id = "preview" this.main.style.position = 'fixed' this.main.style.zIndex = 9999; this.main.style.height = 300; this.main.style.left = 0; this.main.style.visibility = 'hidden'; this.main.style.background = 'lightgrey' document.previewWindow = this // add preview element to the body body = document.getElementsByTagName('BODY')[0]; body.appendChild(this.main); } function PreviewWindow_setTitle(titre) { this.title.textContent = titre } function PreviewWindow_setHTMLContent(content) { this.content.innerHTML = content } function PreviewWindow_setDOMContent(content) { while (this.content.firstChild) this.content.removeChild(this.content.firstChild) this.content.appendChild(content) } function PreviewWindow_setVisible(visible) { if (visible) { window = document.defaultView this.main.style.top = window.innerHeight - 300 this.main.style.width = window.innerWidth; this.main.style.visibility = 'visible' } else this.main.style.visibility = 'hidden' } function PreviewWindow_setID(id) { this.answer.lastChild.value = id } function Color(diff) { colors = [ '#000000','#663300','#996600', '#ff6600','#ff0000'] diff = diff/(60*60); // diff in hours if (diff < 2) // < 2h datecolor = 4; else if (diff < 24) // < 24h datecolor = 3 else if (diff < 48) // < 48h datecolor = 2 else if (diff < (24*7)) // < 7j datecolor = 1 else datecolor = 0; return colors[datecolor] } var msgnb = 0; var valmsgnb = 0; async function ReWrite(par) { if (debug) {console.log("Function Rewrite")}; var child = par.firstChild; var alerttext = ""; done = false; text = ""; currentIndent = 0; currentIndentSpaces = 0; while (!done) { var nodes = []; var i=0; var icon; while (child && child.tagName != "BR") { nodes[i++]=child; if (debug) {console.log("Noeud sauté not BR and not IMG = " + child.tagName)}; if (child.tagName == "IMG" && child.className) { if (debug) {console.log("IMG =" + child.src + child.className)}; icon = child; } child = child.nextSibling; } if (child && child.tagName == "BR") { child1 = child.nextSibling.nextSibling; if (child1 && child1.tagName == "SPAN") child = child1.firstChild else child = child.nextSibling; indentSpaces = nodes[0].length; if (indentSpaces > currentIndentSpaces) { // increases indentation valmsgnb = await GM.getValue(msgnb,"unfolded"); if (valmsgnb == 'folded') { if (currentIndent>0) text += ""; text += "\n"; currentIndent--; } // replace the paragraph by the new computed one newPar = document.createElement('div'); newPar.className = 'noscrollBar'; newPar.style.border = "black solid 1px"; newPar.style.position = 'relative'; newPar.style.width = "60em"; newPar.style.zIndex = 0; //newPar.style.overflow = 'hidden'; divtext = document.createElement('div'); divtext.innerHTML= text; divtext.style.position = 'relative'; divbkg = document.createElement('div'); divbkg.style.position = 'absolute'; divbkg.style.top = 0; divbkg.style.left = 0; divbkg.style.right = 0; divbkg.style.bottom = 0; divbkg.className = 'translucency' //divbkg.style.zIndex = -1; divbkg.style.background = 'white'; valopacity = await GM.getValue("opacity",1); if (valopacity) divbkg.style.opacity = 0.3; newPar.appendChild(divbkg); newPar.appendChild(divtext); par.parentNode.replaceChild(newPar,par); } if (this.location.pathname == "/forum.php") //Si la page est une page du forum { if (debug) {console.log("Page du forum")}; valbackground = await GM.getValue("background",1); if (debug) {console.log("valbackground")}; if (valbackground) { body = document.getElementsByTagName('BODY')[0] body.style.background = document.defaultColor; } allTextareas = document.getElementsByClassName('noscrollBar'); var nbThreads = allTextareas.length; if (debug) {console.log("Number of threads found = " + nbThreads)}; for (var currentThread = 0; currentThread < nbThreads; currentThread++) { if (debug) {console.log("Calling ReWrite for " + currentThread)}; thisTextarea = allTextareas[currentThread]; await ReWrite(thisTextarea); } //listeners arrTextareas = document.getElementsByTagName('img'); if (debug) {console.log("Elements found for folding =" + arrTextareas.length)}; for (var i = 0; i < arrTextareas.length; i++) { // listener fold/unfold pour replier les fils de discussion if (arrTextareas[i].className == 'folding') { if (debug) {console.log("Class folding found for element=" + i)}; thisTextarea = arrTextareas[i]; thisTextarea.addEventListener('click', async function (e) { img=e.currentTarget; a = img.previousSibling.previousSibling.previousSibling; msgid = a.id; if (debug) {console.log("expand msgid = " + msgid)}; if (img.nextSibling.style.display!='none') { img.src = dataIconMaximize; img.nextSibling.style.display = 'none'; await GM.setValue(msgid,'folded'); } else { img.src = dataIconMinimize; img.nextSibling.style.display = 'block'; await GM.setValue(msgid,'unfolded'); } }, false); } // listener detail pour faire apparaître le détail du message if (arrTextareas[i].className == 'detailing') { if (debug) {console.log("Listener detail allTextareas i = " + i)}; thisTextarea = arrTextareas[i]; thisTextarea.addEventListener('click', function (e) { img=e.currentTarget; elm = img.previousSibling.previousSibling.previousSibling; msgid = elm.id; if (debug) {console.log("view msgid = " + msgid)}; if (debug) {console.log("view = " + elm.href)}; logMsgid = "detailed" + msgid; requestPage2(elm.href, i, elm, async function (xhr, j, elmj) { if (xhr.readyState == 4) { text = xhr.responseText; if (debug) {console.log("xhr.responseText = " + text)}; preparepreview = document.createElement('DIV'); preparepreview.innerHTML = text; tables = preparepreview.getElementsByClassName('noscrollBar dispmsg'); msgInsert = tables[0]; if (debug) {console.log("tables [0] = " + msgInsert)}; // var k = 0; // while (tables[k].className != 'noscrollBar dispmsg' && k < tables.length ) { // k++; // } // if (debug) {console.log("tables size = " + tables.length)}; // table = document.createElement('TABLE'); // td1 = document.createElement('TD'); // td1.innerHTML = '
'; // table.appendChild(td1); // td2 = tables[k]; // td2.style.backgroundColor = 'lavender'; msgID = elmj.id; if (debug) {console.log(msgID)}; logMsgID = "detailed" + msgID; ancMsgID = await GM.getValue("anciens",confAnciens); vallogMsgID = await GM.getValue(logMsgID,"unvisited"); if (vallogMsgID == "visited" || msgID <= ancMsgID) msgInsert.style.backgroundColor = 'aqua' else msgInsert.style.backgroundColor = 'white' // table.appendChild(tables[k]); elmj.parentNode.insertBefore(msgInsert, elmj.nextSibling.nextSibling.nextSibling); if (debug) {console.log("setting " + logMsgid)}; await GM.setValue(logMsgid,"visited"); }; } ); }, false); } // listener preview pour faire apparaître fenêtre de prévisu if (arrTextareas[i].className == 'humeur') { thisTextarea = arrTextareas[i]; thisTextarea.addEventListener('click', function (e) { a=e.currentTarget.nextSibling document.previewWindow.setTitle(a.id) document.previewWindow.setVisible(true) document.previewWindow.setHTMLContent("loading message...") document.previewWindow.setID(a.id) requestPage(a.href, async function (xhr) { if (xhr.readyState == 4) { text = xhr.responseText; preparepreview = document.createElement('div') preparepreview.innerHTML = text; tables = preparepreview.getElementsByTagName('table'); var j = 0; while (tables[j].className != 'dispmsg' && j < tables.length ) { j++; } table = tables[j]; table = table.lastChild.lastChild.previousSibling.firstChild.firstChild.nextSibling document.previewWindow.setDOMContent(table) } } ); }, false); } } body.style.backgroundAttachment = 'fixed'; } else if (this.location.pathname == "/message.php") // Si la page est une page fil de discussion { links = document.evaluate( "//a[@class='msg']", document, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null); if (links.snapshotLength > 0) { for ( var i = 0; i < links.snapshotLength; i++) { elm = links.snapshotItem(i); splitResult = elm.href.split("="); msgID = splitResult[1]; if (debug) {console.log(elm)}; if (debug) {console.log(msgID)}; logMsgID = "detailed" + msgID; vallogMsgID = await GM.getValue(logMsgID); if (debug) {console.log("Valeur du flag = " + logMsgID + vallogMsgID)}; logValue = await GM.getValue(logMsgID,"unvisited"); ancValue = await GM.getValue("anciens",confAnciens); if (debug) {console.log("logValue=" + logValue + " - ancValue=" + ancValue)}; if (logValue != "visited" && msgID > ancValue) { requestPage3(elm.href, i, function (xhr,j) { if (xhr.readyState == 4) { text = xhr.responseText; preparepreview = document.createElement('DIV'); preparepreview.innerHTML = text; tables = preparepreview.getElementsByClassName('noscrollBar dispmsg'); msgInsert = tables[0]; if (debug) {console.log("tables [0] = " + msgInsert)}; // tables = preparepreview.getElementsByTagName('TD'); // var k = 0; // while (tables[k].className != 'dispmsg' && k < tables.length ) { // k++; // } elmj = links.snapshotItem(j); if (elmj.previousSibling.previousSibling.previousSibling) espaces = elmj.previousSibling.previousSibling.previousSibling.nodeValue else espaces = ''; table = document.createElement('TABLE'); // table.style.tableLayout = 'fixed'; // table.style.width = '300px'; td1 = document.createElement('TD'); td1.innerHTML = '
' + espaces + '
'; table.appendChild(td1); td2 = msgInsert; td2.style.backgroundColor = 'white'; // td2.style.width = '100%'; // table.appendChild(tables[k]); td2.style.whiteSpace = 'normal'; table.appendChild(td2); elmj.parentNode.insertBefore(table, elmj.nextSibling.nextSibling.nextSibling); }; } ); }; await GM.setValue(logMsgID, "visited"); } }; } })();